<?php
	class xl_loaisanpham extends database
	{
		function LoadAll_LoaiSanPham()
		{
			$sql = "Select * from loaisanpham";
			$this->setQuery($sql);
			$arr = $this->loadAllRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function LoadAll_LoaiSanPham_Limit($start, $display)
		{
			$sql = "Select * from loaisanpham LIMIT $start, $display";
			$this->setQuery($sql);
			$arr = $this->loadAllRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function Load_LoaiSanPham_TheoMa($maloaisanpham)
		{
			$sql = "Select * from loaisanpham where maloaisanpham= '".$maloaisanpham."'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function Xoa_LoaiSanPham($maloaisanpham)

		{			

			$sql ="delete from loaisanpham where maloaisanpham = '".$maloaisanpham."'";

			$this->setQuery($sql);

			return $this->query();	

		}
		
		function Them_LoaiSanPham($tenloaisanpham, $tentat)

		{			
			$sql = "INSERT INTO loaisanpham(tenloaisanpham, tentat) VALUES ('".$tenloaisanpham."','".$tentat."')";					

			$this->setQuery($sql);
			return $this->query();
			//return $sql;

		}
		
		function CapNhat_LoaiSanPham($maloaisanpham,$tenloaisanpham, $tentat)
		{			
			$sql = "UPDATE loaisanpham SET tenloaisanpham='".$tenloaisanpham."',tentat='".$tentat."' WHERE maloaisanpham='".$maloaisanpham."'";
			$this->setQuery($sql);
			return $this->query();
			//return $sql;
		}
		
	}
?>